package com.qf.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.mapper.UserMapper;

import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * projectName: forth
 *
 * @author: MaTianWei
 * time: 2021/8/1 14:53
 * description:
 */
@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findUserAll() {
        List<User> userAll = userMapper.findUserAll();
        return userAll;
    }

    @Override
    public PageInfo<User> findUserPage(Integer pageNum) {
        //1设置分页插件
        PageHelper.startPage(pageNum,5);
        //2查询从第几条书据开始
        List<User> list = userMapper.findUserAll();
        //3返回
        PageInfo<User>pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
